package org.example03.mapper;

import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;
import org.example03.po.User;

import java.util.List;

public interface UserMapper {
    @Results({
            @Result(column = "id", property = "id",id = true),
            @Result(property = "orders",javaType = List.class,
                    column = "id",
                    many = @Many(select = "org.example03.mapper.OrderMapper.getOrderByUserId",fetchType = FetchType.LAZY))
    })
    @Select("select * from mybatis02.user")
    List<User> getAllUser();
}
